//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.wsd.smartcarwasher.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

@ApiModel("管理员")
public class Admin implements Serializable {
    private static final long serialVersionUID = 146121348945L;
    private static final String[] authlevels = new String[]{"0"};
    @ApiModelProperty("id")
    private Integer id;
    @ApiModelProperty("昵称")
    private String nickname;
    @ApiModelProperty("真实姓名")
    private String realname;
    @ApiModelProperty("电话号码")
    private String cellphone;
    @ApiModelProperty("密码")
    private String password;
    private String authlevel;
    @ApiModelProperty("备注")
    private String addition;
    private String salt;
    @ApiModelProperty("加盟商id")
    private Integer partnerId;

    public Integer getPartnerId() {
        return partnerId;
    }

    public void setPartnerId(Integer partnerId) {
        this.partnerId = partnerId;
    }

    @Override
    public String toString() {
        return "Admin{" +
                "id=" + id +
                ", nickname='" + nickname + '\'' +
                ", realname='" + realname + '\'' +
                ", cellphone='" + cellphone + '\'' +
                ", password='" + password + '\'' +
                ", authlevel='" + authlevel + '\'' +
                ", addition='" + addition + '\'' +
                ", salt='" + salt + '\'' +
                ", partnerId=" + partnerId +
                '}';
    }

    //角色
    private List<Long> roleIds;

    public List<Long> getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(List<Long> roleIds) {
        this.roleIds = roleIds;
    }

    public Admin() {
    }

    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNickname() {
        return this.nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getRealname() {
        return this.realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getCellphone() {
        return this.cellphone;
    }

    public void setCellphone(String cellphone) {
        this.cellphone = cellphone;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getAuthlevel() {
        return this.authlevel;
    }

    public void setAuthlevel(String authlevel) {
        this.authlevel = authlevel;
    }

    public String getAddition() {
        return this.addition;
    }

    public void setAddition(String addition) {
        this.addition = addition;
    }

    public String getSalt() {
        return this.salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public boolean isFieldsValid() {
        return StringUtils.isNotBlank(this.nickname) && StringUtils.isNotBlank(this.realname) && StringUtils.isNotBlank(this.password) && StringUtils.isNotBlank(this.authlevel) && this.isValidAuthlevel();
    }

    private boolean isValidAuthlevel() {
        return Arrays.asList(authlevels).contains(this.authlevel);
    }
}
